#!/usr/bin/env node
const fs=require('fs'),
      fileName=process.argv[2],
      log=console.log;
//同步操作
//如果没有命令行参数，默认打印脚本本身
 
try{
  let fid=fs.openSync(fileName,'r'),
      size=fs.statSync(fileName).size,
      buf=new Buffer(size);
  fs.readSync(fid,buf,0,size,0);
  log(buf.toString('utf-8'));
  fs.closeSync(fid);
}catch(e){
  console.log(e.message);
}

